<?php if (!isset($v_sval)) exit; ?>
<?php
$v_offset = (isset($_REQUEST["hdn_offset"])) ? $_REQUEST["hdn_offset"] : 0;
$v_num_row = (isset($_REQUEST["hdn_num_row"])) ? $_REQUEST["hdn_num_row"] : SYS_ITEMS_PER_PAGE;

$news_id = (isset($_REQUEST["hdn_news_id"])) ? $_REQUEST["hdn_news_id"] : 0;
$news_content = '';
$news_time = '';

if ( $news_id ){
	if ( getOwnerNews($news_id) == $user_id ){	
		$rs = getSingerNews ($news_id);
		if ($arr = mysql_fetch_assoc($rs)){
			$news_time = convertSQLDatetoDate($arr['NEWS_TIME'],true);
			$news_content = $arr['NEWS_CONTENT'];
		}
	}else{
		redir('?a=ACC&acc=USER&user=DIAR');
	}
}

$v_where_clause = " AND NEWS_CATEGORY = '".NEWS_CATEGORY_USER_DIARY."' AND ACCOUNT_ID = '".$user_id."'";
$rs_all_news = getAllNews($v_where_clause,$v_offset ,$v_num_row);
$v_dsp_news_list = '';
    $v_inc = 1;
while ( $arr_news = mysql_fetch_array($rs_all_news,MYSQL_NUM)){
	$v_news_id=$arr_news["0"];
	$v_news_content=$arr_news["4"];
	$v_news_time=$arr_news["5"];
	
	$v_dsp_news_list .='
	<div class="diary_element">
		<div class="left diary_time_content w120">
			<span class="diary_date_of_week">'.$arr_day_of_week[date("D",strtotime($v_news_time))].'</span><br/>
			<span class="diary_day">'.date("d",strtotime($v_news_time)).'</span>
			<span class="diary_time">'.date("H:i",strtotime($v_news_time)).'</span>
			<br/>	
			<span class="diary_month_year">'._LB_MONTH.$arr_month[date("M",strtotime($v_news_time))].' '.date("Y",strtotime($v_news_time)).'</span>
		</div>
		<div class="left diary_content">
			<a href="?a=ACC&acc=USER&user=DIAR&diar=V&hdn_news_id='.$v_news_id.'">
				'.generateShortDesc($v_news_content,10).'
			</a>
		</div>
		<div class="right">
			<a class="button left" href="?a=ACC&acc=USER&user=DIAR&diar=V&hdn_news_id='.$v_news_id.'">
				'._IMAGE_VIEW_IMAGE.'
			</a>
			<a class="button left" href="?a=ACC&acc=USER&user=DIAR&hdn_news_id='.$v_news_id.'">
				'._IMAGE_EDIT_IMAGE.'
			</a>
			<a class="button left" onclick=\'if(!confirm("Chac chan chua")){return false;}\' href="?a=ACC&acc=NEWS&news=NEWS&news=D&hdn_news_id='.$v_news_id.'">
				'._IMAGE_DELETE_IMAGE.'
			</a>
		</div>
		<div class="clear"></div>
	</div>';	
	$v_inc++;

}
$v_dsp_news_list .='';		
$v_number_of_all_result = countAll($v_where_clause,'TB_NEWS');
?>
